<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('监控小组列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>小组编号：</p>
                                <input type="text" name="groupCode"/>
                            </li>
                            <li>
                                <p>小组名称：</p>
                                <input type="text" name="groupName"/>
                            </li>
                            <li>
                                <a class="btn btn-info single disabled" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-default single disabled" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="paeaAuAuditGroup">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="oms:paeaAuAuditGroup:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="oms:paeaAuAuditGroup:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="oms:paeaAuAuditGroup:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="oms:paeaAuAuditGroup:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
                <a class="btn btn-primary single disabled" onclick="assign()" shiro:hasPermission="oms:paeaAuAuditGroup:export">
                    <i class="fa fa-gear"></i> 人员分配
                </a>
                <a class="btn btn-primary single disabled" onclick="assignOrg()" shiro:hasPermission="oms:paeaAuAuditGroup:export">
                    <i class="fa fa-gear"></i> 机构分配
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('oms:paeaAuAuditGroup:edit')}]];
        var removeFlag = [[${@permission.hasPermi('oms:paeaAuAuditGroup:remove')}]];
        var prefix = ctx + "oms/paeaAuAuditGroup";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "监控小组",
                //启用跳转至指定页
                showPageGo: true,
                //启用点击选中行
                clickToSelect: true,
                columns: [{
                    checkbox: true
                },
                {
                    field : 'groupId', 
                    title : '主键',
                    visible: false
                },
                {
                    field : 'groupCode', 
                    title : '小组编号'
                },
                {
                    field : 'groupName', 
                    title : '小组名称'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.groupId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.groupId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="assignUserDetail(\'' + row.groupCode + '\')"><i class="fa fa-edit"></i>人员详细</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="assignDeptDetail(\'' + row.groupCode + '\')"><i class="fa fa-edit"></i>机构详细</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        //人员分配
        function assign(){
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            if ($.common.isEmpty(row)) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            var url = prefix + '/auditGroupAssignUserConfig/' + row.groupCode;
            $.modal.openTab("配置-"+row.groupName+"-监控人员", url);
        }
        //机构分配
        function assignOrg() {
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            if ($.common.isEmpty(row)) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            var url = prefix + '/auditGroupAssignDeptConfig/' + row.groupCode;
            $.modal.openTab("配置-"+row.groupName+"-监控机构", url);
        }
        //查看监控小组人员详细
        function assignUserDetail(groupId) {
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            if ($.common.isEmpty(row)) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            var url = prefix + '/auditGroupAssignUserDetail/{groupId}';
            url = url.replace("{groupId}",groupId);
            window.showModalDialog(url,"","dialogWidth=800px; dialogHeight=600px; help=no; status=no; scroll=yes; resizable=no;");
        }
        //查看监控小组机构详细
        function assignDeptDetail(groupId) {
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            if ($.common.isEmpty(row)) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            var url = prefix + '/auditGroupAssignDeptDetail/{groupId}';
            url = url.replace("{groupId}",groupId);
            window.showModalDialog(url,"","dialogWidth=800px; dialogHeight=600px; help=no; status=no; scroll=yes; resizable=no;");
        }


    </script>
</body>
</html>